package xyz.zdsoft.attendance_manage_module.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import xyz.zdsoft.attendance_manage_module.vo.AttendanceInfoVo;

/**
 * @author 王林
 * @version 1.0
 * @date 2021-07-25 周日
 * @time 22:33
 * @description
 */

@Mapper
public interface TeacherAttendanceMapper extends BaseMapper {

    @Select({"<script>", "select s.leave_id,s.project_id,s.project_date,s.team_name,s.colleges_name,s.major_name,s.grade_name,\n" +
            "            s.class_name,s.course_name,s.duty_teacher,s.train_teacher,\n" +
            "            s.user_no,s.student_name,s.attendance_type,\n" +
            "            s.sign_in_time,s.sign_out_time,\n" +
            "            s.real_start_time,s.real_end_time\n" +
            "from stu_all_attendance_info_view s\n" +
            "where s.teacher_id = #{teacherId}" +
            "<if test=\"ew.sqlSegment != null and ew.sqlSegment != ''\">\n" +
            "and ${ew.sqlSegment}\n" +
            "        </if>",
            "</script>"})
    IPage<AttendanceInfoVo> queryAllCourse(IPage<AttendanceInfoVo> page,
                                           @Param("ew") Wrapper<AttendanceInfoVo> wrapper,
                                           @Param("teacherId") Integer teacherId);

}
